var express = require('express');
var app = express();
var allowCrossDomain = function(req, res, next) {
  res.header('Access-Control-Allow-Origin', '*');
  next();
};
app.use(allowCrossDomain);


// 引入路由模块
var StoreRouter = require('./routes/store.js');
var UserRouter = require('./routes/user.js');
var DetailRouter = require('./routes/storeDetail.js');
var CityRouter = require('./routes/city.js');


// 使用路由模块，中间件
app.use('/api/store/', StoreRouter);
app.use('/api/user/', UserRouter);
app.use('/api/detail/', DetailRouter);
app.use('/api/city/', CityRouter);

app.listen(3000);
console.log('服务启动成功');
